//
// Created by wenyaxi on 24-10-29.
//
#include <common.h>

class Solution {
public:
    ListNode *detectCycle(ListNode *head) {
        unordered_set<ListNode *> memory;
        while (head) {
            if(memory.contains(head)) {
                return head;
            }
            memory.insert(head);
            head = head->next;
        }
        return nullptr;
    }
};

int main(int argc, char *argv[]) {
    return 0;
}
